package com.example.activitydemo

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity

class Activity3 : AppCompatActivity() {
    private lateinit var inputEt: EditText
    private lateinit var confirmBtn: Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // 关键修改：将 activity3 改为 activity_3
        setContentView(R.layout.activity_3)

        inputEt = findViewById(R.id.editText)
        confirmBtn = findViewById(R.id.confirm)

        confirmBtn.setOnClickListener {
            val inputText = inputEt.text.toString().trim()
            val intent = Intent().apply {
                putExtra("return_data", inputText)
            }
            setResult(RESULT_OK, intent)
            finish()
        }
    }
}